package noppes.vc.items;

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.MobEffects;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.math.BlockPos;
import noppes.vc.EntityProjectile;
import noppes.vc.EntityProjectile$IProjectileCallback;
import noppes.vc.enchants.VCEnchant;

class ItemGun$3 implements EntityProjectile$IProjectileCallback {
   // $FF: synthetic field
   final ItemStack val$stack;
   // $FF: synthetic field
   final ItemGun this$0;

   ItemGun$3(ItemGun this$0, ItemStack var2) {
      this.this$0 = this$0;
      this.val$stack = var2;
   }

   public boolean onImpact(EntityProjectile entityProjectile, BlockPos pos, Entity entity) {
      if (entity != null && entity instanceof EntityLivingBase) {
         EntityLivingBase living = (EntityLivingBase)entity;
         int confusion = VCEnchant.getLevel(VCEnchant.Confusion, this.val$stack);
         if (confusion > 0 && living.getRNG().nextInt(4) > confusion) {
            living.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, 100));
         }

         int poison = VCEnchant.getLevel(VCEnchant.Poison, this.val$stack);
         if (poison > 0 && living.getRNG().nextInt(4) > poison) {
            living.addPotionEffect(new PotionEffect(MobEffects.POISON, 100));
         }

         return false;
      } else {
         return false;
      }
   }
}
